UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8A8JM9Ah0cWKCQm/BzeM8o/xuYAUBBd1sOW5FAb5P8=' 
WHERE 
  key_id = '5795209b8e63bf0146d4a22cdbafba7456675ced80f7f999cca75e3b86cfb803' 
  AND (
    token = 'w8A8JM9Ah0cWKCQm/BzeM8o/xuYAUBBd1sOW5FAb5P8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032