UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xCCaQCnKHIUtJ+ADdgbbNTHHrZ0RdxLHoPaXsy+1l0o=' 
WHERE 
  key_id = '090dd56471e58a06260391544f4b1b81f6dce8eaf0f61927af6fda95d1c14248' 
  AND (
    token = 'xCCaQCnKHIUtJ+ADdgbbNTHHrZ0RdxLHoPaXsy+1l0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042