UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4MwWQiT/5D4CD1vLS7NP+vqcrIv8jSheloLiuunXoqM=' 
WHERE 
  key_id = 'b5ba697a16dbb437b998849ef9295ef30e8e784725cde0a81480dc14e1550394' 
  AND (
    token = '4MwWQiT/5D4CD1vLS7NP+vqcrIv8jSheloLiuunXoqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042