UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GWIvvHvzJ9EaknxYec9id0CFGTmIwrkaFnFThj7Zrcs=' 
WHERE 
  key_id = '669f8cc31bed13b584c7753edcdb8351ae7b9ee4f9a9cee1dfc8cc5a224033a7' 
  AND (
    token = 'GWIvvHvzJ9EaknxYec9id0CFGTmIwrkaFnFThj7Zrcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040