UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6801DfleLlxCGuWW9TD0U28VRkCcS6cZsiM3ToKtxJM=' 
WHERE 
  key_id = 'aa684ab0f63cb7ae83ca1f89e30e59fd13e06df7ae94e2ad5ca3c456340aabd1' 
  AND (
    token = '6801DfleLlxCGuWW9TD0U28VRkCcS6cZsiM3ToKtxJM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035