UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kdmiigtGAsT8Qz35GKt2AIpQTvZAklkv7IrrJS+lutw=' 
WHERE 
  key_id = 'd7767060043992f5e2a5b6e81641cbb2f5dc62fb43579d45359393f374c5d339' 
  AND (
    token = 'kdmiigtGAsT8Qz35GKt2AIpQTvZAklkv7IrrJS+lutw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027