UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BgQ9xV5y/kVFX8dcASiC4zqKMf93VehE/jkrF0fmLbM=' 
WHERE 
  key_id = '7b02b1825df57a6f20888fc24815ebb44025dc38dd17a05765b3ee08e5e20bf6' 
  AND (
    token = 'BgQ9xV5y/kVFX8dcASiC4zqKMf93VehE/jkrF0fmLbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023