UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y1KrjFBPTT2SGDGqgpP88EhGWzzliKAZTrVZ1uoUUhk=' 
WHERE 
  key_id = '4872bbca2e9a437adf6cdbdcf711dd441657cd8d536350c00e2769214d4d83ac' 
  AND (
    token = 'Y1KrjFBPTT2SGDGqgpP88EhGWzzliKAZTrVZ1uoUUhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018