UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F+tjXxU11zazxkTqRu8AGIBzufNuqZPZcnrsWSjKAB0=' 
WHERE 
  key_id = '0c14d4f9eedff1d982a9784a855cd3e2d150d5547db4476d3736a5daa9836066' 
  AND (
    token = 'F+tjXxU11zazxkTqRu8AGIBzufNuqZPZcnrsWSjKAB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025