UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a7e5okl+19SIkEWmWbfAgjNB3Mzui3WowkDk+MiaIlo=' 
WHERE 
  key_id = 'd1a2e3f58280bc414c6fb56d23516831476a85163d8eb4c5e6ee130845a99233' 
  AND (
    token = 'a7e5okl+19SIkEWmWbfAgjNB3Mzui3WowkDk+MiaIlo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057