UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dQE/B9DYoOPXI/vPeBa1N9fsek/5KR8D7zvvqAj1Sqk=' 
WHERE 
  key_id = '940fd2f783c6a503f3d2b0fef3b7286969d68bcd74897e080e6510713aef339e' 
  AND (
    token = 'dQE/B9DYoOPXI/vPeBa1N9fsek/5KR8D7zvvqAj1Sqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042