UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ev+Y66+0mNCeTbM2PwjN3eUOL2YomeLyFUg2nItXE4Q=' 
WHERE 
  key_id = 'd76b016fee1527443595c44e0a37a4b1ace4e862963dcb41c6c8ddc716f2b305' 
  AND (
    token = 'ev+Y66+0mNCeTbM2PwjN3eUOL2YomeLyFUg2nItXE4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030