UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BZH4bO6DSRu0HBaj9D7MctKxsNhl7xJoDQ0N0qMv6as=' 
WHERE 
  key_id = '7741b5c54eb0381e8acf14940122bef9f215a7cbe63e5edd887acfae7b52f2f2' 
  AND (
    token = 'BZH4bO6DSRu0HBaj9D7MctKxsNhl7xJoDQ0N0qMv6as=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032