UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o2GoEGM6NUqqMte3TUX+rkdR4o69hh56AwiNuVFArFw=' 
WHERE 
  key_id = '046fd0e2dbf8474fc20b525aae2474511050590a8f0efc2e5b49f404dbf15ff8' 
  AND (
    token = 'o2GoEGM6NUqqMte3TUX+rkdR4o69hh56AwiNuVFArFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041