UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jfqm131soBU2KMB6MAmMROAc1TSXKmTRgstvJvAGJJU=' 
WHERE 
  key_id = '53d6b933200858cedb6e8f8d69d5e6eb55274098104ed87f044b75b2ea440eb1' 
  AND (
    token = 'jfqm131soBU2KMB6MAmMROAc1TSXKmTRgstvJvAGJJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030