UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6fXY0Vt+zzW0B+gv22T/HO2ZEBE8HGWMhqOs1j+8d9w=' 
WHERE 
  key_id = '491d6563cca2efce68f352eb6a180e4d95168a9a68b586f3849f734f1ca485a8' 
  AND (
    token = '6fXY0Vt+zzW0B+gv22T/HO2ZEBE8HGWMhqOs1j+8d9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029