UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JQefM9hf8SuHfRGRSXvD/hCoupUSTtNb/XqDzRB+Xvc=' 
WHERE 
  key_id = '4184f59aaff16effa30315c981acd686b09b8f1d431fbdfb631e55270c7f5e3c' 
  AND (
    token = 'JQefM9hf8SuHfRGRSXvD/hCoupUSTtNb/XqDzRB+Xvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034