UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wEYyIEccg3C2PTZNgv/6D1iygrjFhegSX3SAKBIYVBs=' 
WHERE 
  key_id = '837b4fcd76d97a4eb1e041fe7711751e650f64368ea2427aae930b8e6d20a77a' 
  AND (
    token = 'wEYyIEccg3C2PTZNgv/6D1iygrjFhegSX3SAKBIYVBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026