UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SgTDDlpDFERb/xmMVOIJhIxN8tr3aU6lK+5N9u7L1Fk=' 
WHERE 
  key_id = 'ff29302bdee8e974f0fcea28ce06efc896842347af24be5d053bdc0ec50a2e0f' 
  AND (
    token = 'SgTDDlpDFERb/xmMVOIJhIxN8tr3aU6lK+5N9u7L1Fk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017