UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MKJrzWeSjqbBHfx0rT0sURjO+9bm7aQ53Wq4MR7X/7g=' 
WHERE 
  key_id = '918153420a9f38aca413c4c73207befdd55053a443296e6b829ed92109dd26cf' 
  AND (
    token = 'MKJrzWeSjqbBHfx0rT0sURjO+9bm7aQ53Wq4MR7X/7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030