UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BeXFApG9CVcx17qnDkbd9/2tskzrDlKhsJQXT7AfzzU=' 
WHERE 
  key_id = 'bd47f0404fb084064c26f5d842693aa6abe9f5adedcf6826970798e8ee92215a' 
  AND (
    token = 'BeXFApG9CVcx17qnDkbd9/2tskzrDlKhsJQXT7AfzzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035