UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RXsQSyc8bA4xR4AIQdzosB9Wnul+t7CdwUHUy7y8fZs=' 
WHERE 
  key_id = '9e733a55e6ca300ac285eab3f039960cf0d5203199e16bc38288035a2b4ca84b' 
  AND (
    token = 'RXsQSyc8bA4xR4AIQdzosB9Wnul+t7CdwUHUy7y8fZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045