UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KpnjtxxZxBgW0t++mB7yI7M7nnKiG7+YOUAV9C4LqyM=' 
WHERE 
  key_id = '3256fa984460055617d8c52b7cdd27759a40d97d358323826cf2a6cf7fc2c8f5' 
  AND (
    token = 'KpnjtxxZxBgW0t++mB7yI7M7nnKiG7+YOUAV9C4LqyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047