UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1A/8Lt4LIpkIUAcc+NvfvRwr8pZJqKkYrCngoAtYPI=' 
WHERE 
  key_id = '7f824dd36cb4572a178f02d3c328e36c12d5d26aa618aef5332de9c1fd985c0a' 
  AND (
    token = 'K1A/8Lt4LIpkIUAcc+NvfvRwr8pZJqKkYrCngoAtYPI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026