UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZGFwTu8En5YynifTWvMRa241WOFcvDCdmVCwnh92wtc=' 
WHERE 
  key_id = '64431e7d60a9ddc9495a6d98518ce8ba696f5fd00eb05e57639f897b11fbd695' 
  AND (
    token = 'ZGFwTu8En5YynifTWvMRa241WOFcvDCdmVCwnh92wtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018