UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kyiHxWv1oBwFnCe2yPRjzMNYxffAU9Cpj4px6D0s6Y0=' 
WHERE 
  key_id = 'a40c1c46efc5825fd10a12cd1056b1ba37611089fd9d606f16ee2cdcb062264a' 
  AND (
    token = 'kyiHxWv1oBwFnCe2yPRjzMNYxffAU9Cpj4px6D0s6Y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036