UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B2cgynVuE/P7uasBCZGGrdF96Kot8BxlvMYws1DQdWY=' 
WHERE 
  key_id = '801274c48596cbb4e0322ebde85020c20fab6bda9fa215b28571ff693432db6b' 
  AND (
    token = 'B2cgynVuE/P7uasBCZGGrdF96Kot8BxlvMYws1DQdWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059