UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AmRqNeh3Um9+/UOzWxbvWHNlDl94MmFx1B23bB6ZfhY=' 
WHERE 
  key_id = '06d6312cd020c07f8591d5e2350262f033331641d8e7b9d3a191b7776f26b956' 
  AND (
    token = 'AmRqNeh3Um9+/UOzWxbvWHNlDl94MmFx1B23bB6ZfhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035