UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1hxHgfxcj7O+xjpIujHD+zMtEFxRes5mF3g55UL4aQU=' 
WHERE 
  key_id = 'c4b7c33213768c63174c7675574d7a6f8c028fe2a55b38c9e64083f508279cbc' 
  AND (
    token = '1hxHgfxcj7O+xjpIujHD+zMtEFxRes5mF3g55UL4aQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051