UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T2RQcslrFl3epdBhEkQkZc7wJ6enOUOQInBqSm/M19s=' 
WHERE 
  key_id = 'afbf38851bcdb34f7fe5979839439deb46a0d6abde2dca2712dd0633958881a8' 
  AND (
    token = 'T2RQcslrFl3epdBhEkQkZc7wJ6enOUOQInBqSm/M19s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042