UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NxHzP43OGkId4ZEZhCyo0M5XroZ9k8is5eGFImha44I=' 
WHERE 
  key_id = '01bb19c10c72379c080f2804846bee64fd78616cf5d787ea19c007e17c55ebca' 
  AND (
    token = 'NxHzP43OGkId4ZEZhCyo0M5XroZ9k8is5eGFImha44I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062