UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NK+3Dm0c7UbMAJKrpjzPUbLz70pzNb/5MMf/8fbSXJg=' 
WHERE 
  key_id = '3db58393fc3a96c04d1ced8b9e16bb049222554634ffcf823957b9c41f94d238' 
  AND (
    token = 'NK+3Dm0c7UbMAJKrpjzPUbLz70pzNb/5MMf/8fbSXJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045