UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JsHk6FG2AxnyPVGUpsIteLA6S90e6JJRrYvYycbT1TM=' 
WHERE 
  key_id = '226a683cc9ec7afcd504235643a16af1f81bb079a65b04f25b2829318f7de28b' 
  AND (
    token = 'JsHk6FG2AxnyPVGUpsIteLA6S90e6JJRrYvYycbT1TM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083