UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6V22RqHq2QmmWzYz0jlTC9CIGL7zzztklkL1RinDhPk=' 
WHERE 
  key_id = '39aad4ddb8eabc4b890f990e4911bea2a56388380496ff03c4e13c426d9bc7b7' 
  AND (
    token = '6V22RqHq2QmmWzYz0jlTC9CIGL7zzztklkL1RinDhPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017