UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AAYDNP7cscos8Tw7PgOoPgV3uFajz5wquYRmYgi5o3s=' 
WHERE 
  key_id = '2da32933486c24adc25f1555165a10fc62de92d7cc113aca211828312b096655' 
  AND (
    token = 'AAYDNP7cscos8Tw7PgOoPgV3uFajz5wquYRmYgi5o3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054