UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJ0877RxFf+faUerhczrRQ/FjI7O6zi2d2vekFOL4ME=' 
WHERE 
  key_id = 'c1f7b960f2e33d5b51ca45f3086a966ae98ab8719b07add3eb715d209518a859' 
  AND (
    token = 'XJ0877RxFf+faUerhczrRQ/FjI7O6zi2d2vekFOL4ME=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021