UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tX/U8dMf16U5zPr29J8UDrwWufruCUo40nAlJFklsSU=' 
WHERE 
  key_id = '3ab141af9738c171bb789aa60a30dd5f7865b3dc4ba1f4042cd69c6e2837215c' 
  AND (
    token = 'tX/U8dMf16U5zPr29J8UDrwWufruCUo40nAlJFklsSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025