UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5OY1fdyR5pbPePA23iBCbhIoR26HxEGCKz+nCeAxLXU=' 
WHERE 
  key_id = '43a50bf585d31247cdbd38468d4a08e33d7753685525a3170ec186e3a51541d3' 
  AND (
    token = '5OY1fdyR5pbPePA23iBCbhIoR26HxEGCKz+nCeAxLXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035