UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UmZPTweFzYh4rGO3mOnG38Chyst+tSStZzaKqgw9IrI=' 
WHERE 
  key_id = '9f8e5022e88714c5bee680ad8fbeb8bc15bdfe117543c49375fb8dd325262202' 
  AND (
    token = 'UmZPTweFzYh4rGO3mOnG38Chyst+tSStZzaKqgw9IrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053