UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7PgeoTwgxXc7BOZ8qoAVSOW60mmhvV4q/gwXM744mE=' 
WHERE 
  key_id = '8bfc27dd6dede7b7632a177309155e684a1481927d388cd221c514ee9a4d28e7' 
  AND (
    token = 'f7PgeoTwgxXc7BOZ8qoAVSOW60mmhvV4q/gwXM744mE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018